﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Component;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Sessions.CurrentUser == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            this.ChooseControl(this.GetQuery());
        }
    }
    string GetQuery()
    {
        try
        {
            return QueryHelper.GetQueryString(Request, ConstString._Wand);
        }
        catch
        {
            return "";
        }
    }
    void LoadControlInCenter(string controlPath)
    {
        this.pnpCenter.Controls.Clear();
        this.pnpCenter.Controls.Add(LoadControl(controlPath));
    }
    void ChooseControl(string query)
    {
        this.pnpTop.Controls.Add(LoadControl(BackEndPath._TopMenu));
        switch (query)
        {
            case BackEndQuery._ImagesList:
                LoadControlInCenter(BackEndPath._ImagesList);
                break;
            case BackEndQuery._ImagesModify:
                LoadControlInCenter(BackEndPath._ImagesModify);
                break;
            case BackEndQuery._CategoryL:
                LoadControlInCenter(BackEndPath._CategoryL);
                break;
            case BackEndQuery._CategoryM:
                LoadControlInCenter(BackEndPath._CategoryM);
                break;
            case BackEndQuery._CategoryMS:
                LoadControlInCenter(BackEndPath._CategoryMS);
                break;

            case BackEndQuery._CategorySub:
                LoadControlInCenter(BackEndPath._CategorySub);
                break;
            case BackEndQuery._LienHeL:
                LoadControlInCenter(BackEndPath._LienHeL);
                break;
            case BackEndQuery._LienHeM:
                LoadControlInCenter(BackEndPath._LienHeM);
                break;
            case BackEndQuery._NewsL:
                LoadControlInCenter(BackEndPath._NewsL);
                break;
            case BackEndQuery._NewsM:
                LoadControlInCenter(BackEndPath._NewsM);
                break;
            case BackEndQuery._UserChangePassword:
                LoadControlInCenter(BackEndPath._UserChangePassword);
                break;
            
            default:
                LoadControlInCenter(BackEndPath._CategoryL);
                return;

        }
    }
}
